package com.cloud.feeling.ststem.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloud.common.model.Depart;
import com.cloud.feeling.ststem.mapper.DepartMapper;
import com.cloud.feeling.ststem.service.DepartService;

@Service
public class DepartServiceImpl implements DepartService {

	@Autowired
	public DepartMapper departMapper;
	
	@Override
	public List<Depart> list() {
		return departMapper.list();
	}

	@Override
	public Depart getByparentId(Integer parentId) {
		return departMapper.getByparentId(parentId);
	}

	@Override
	public void savedepart(Depart depart) {
		if(depart!=null&&depart.getId()!=null) {
			departMapper.updatedepart(depart);
		}else {
			departMapper.savedepart(depart);
		}
	}

	@Override
	public void deleteDepartByid(Integer id) {
		departMapper.deleteDepartByid(id);
	}

}
